#!/bin/sh
# - nr_threads
# - array_size
# - omp
# - loop
# - iterations

. $LKP_SRC/lib/debug.sh
. $LKP_SRC/lib/reproduce-log.sh

log_cmd cd $BENCHMARK_ROOT/$testcase || die "can not enter $BENCHMARK_ROOT/$testcase"

log_cmd export OMP_NUM_THREADS=$nr_threads

[ -n "$array_size" ] || die "can not get array size"
[ -n "$omp" ] || die "can not get omp"
[ -n "$loop" ] || loop=100

[ "$omp" = "true" ] && omp_options="-fopenmp"

log_cmd gcc -O stream.c -o stream -D"STREAM_ARRAY_SIZE=$array_size" -DNTIMES=$loop $omp_options ||
die "failed to compile stream"

for i in $(seq $iterations)
do
	echo Iteration: $i
	log_cmd ./stream || die "failed to run stream"
done
